﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/MyAccount.cshtml";
}
@*<div class="MycoentRight lf">

    <ul>
        <li class="curt"><a href="#">正在投标的借款</a><span></span></li>
    </ul>
</div>*@
    <script>
        $(function () {
            Page(1);
        });
        var counttt;
        function Page(i) {
            $.getJSON("/InvestGuanLi/TouBiaoIng_Show", { pageindex:i, pagesize: 2 }, function (data) {
                var str = "<tr class=''><th style='width:150px;'>借款标题</th><th style='width:120px;'>借款人</th><th style='width:100px;'>期数/利率</th><th style='width:110px;'>投标金额</th><th style='width:150px;'>投标时间</th><th style=' width:90px;'>进度</th><th style=' width:80px;'>状态</th></tr>";

                for (var i = 0; i < data.Data.length; i++) {
                    //转换时间格式
                    data.Data[i].LaunchLoanTime = data.Data[i].LaunchLoanTime.replace("/Date(", "").replace(")/", "");
                    if (data.Data[i].LaunchLoanTime.indexOf("+") > 0) {
                        data.Data[i].LaunchLoanTime = data.Data[i].LaunchLoanTime.substring(0, data.Data[i].LaunchLoanTime.indexOf("+"));
                    }
                    else if (data.Data[i].PRDetailsInDatetime.indexOf("-") > 0) {
                        data.Data[i].LaunchLoanTime = data.Data[i].LaunchLoanTime.substring(0, data.Data[i].LaunchLoanTime.indexOf("-"));
                    }
                    var date = new Date(parseInt(data.Data[i].LaunchLoanTime, 10));
                    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
                    str += "<tr class=''><td style='width:150px;'>" + data.Data[i].Title + "</td><td style='width:120px;'>" + data.Data[i].UserName + "</td><td style='width:100px;'>" + data.Data[i].Annualrate + "</td><td style='width:110px;'>" + data.Data[i].LoanMoney + "</td><td style='width:150px;'>" + date.getFullYear() + "-" + month + "-" + currentDate + "</td><td style=' width:90px;'>" + data.Data[i].BaiFenBi + "%</td><td style=' width:80px;'>" + data.Data[i].ExamineState + "</td></tr>";
                }
                $("#tables").html(str);
                counttt = data.PageCount;
                var tas = "<tr style='background-color:#eddede';><td>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span> 共<label id='sums'>" + data.PageCount + "</label>  页 &nbsp&nbsp&nbsp&nbsp当前第 <label id='index'>" + data.PageIndex + "</label> 页&nbsp&nbsp&nbsp&nbsp <a onclick='Page(1)'>首页</a>&nbsp&nbsp&nbsp&nbsp";
                //判断当前页是否为1，如果不是那就减一如果是那就直接定到第一页
                if (data.PageIndex <= 1) {
                    tas += ("<a  onclick='Page(1)'  >上一页</a>&nbsp&nbsp&nbsp&nbsp");
                }
                else {
                    tas += ("<a  onclick='Page(" + (data.PageIndex - 1) + ")'  >上一页</a>&nbsp&nbsp&nbsp&nbsp");
                }
                //判断是否为最后一页。如果不是那就加一如果是那就直接定到最后一页
                if (data.PageIndex >= data.PageCount) {
                    tas += "<a  onclick='Page(" + (data.PageCount) + ")' >下一页</a>&nbsp&nbsp&nbsp&nbsp";
                } else {
                    tas += "<a  onclick='Page(" + (data.PageIndex + 1) + ")' >下一页</a>&nbsp&nbsp&nbsp&nbsp";
                }
                tas += " <a onclick='Page(" + data.PageCount + ")'>尾页</a>&nbsp&nbsp&nbsp&nbsp";
                //跳转页
                tas += "转到<input id='pageas' style='width:50px' type='text' /><input id='Button1' type='button'  onclick='tiaozhuan()'  value='确定' /></span></td> </tr>";
                $("#tass").html(tas);
            });
        };
        //跳转分页
        function tiaozhuan() {
            var idd = $("#pageas").val();
            if (idd > counttt) {
                alert("您输入的页数到达极限！为您跳转到尾页");
                Page(counttt);
            } else {
                Page(idd);
            }
        };
    </script>
<div class="MyTabMuen">
    <ul>
        <li class="curt"><a href="#">正在投标的借款</a><span></span></li>
    </ul>
    <div class="clear"></div>
</div>


    <div class="Biding">
        <div class="Result_tj"><span>冻结投标总额：<b class="red">0.00</b></span></div>
        <div class="jkinfo">
            <table cellspacing="0" id="tables" cellpadding="0" class="table_list" style=" width:920px; font-size:12px;">
                

            </table>
            <table id="tass"></table>
        </div>
        
    </div>
  
